package xyz.zhouzhaodong.crm.controller;


import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import xyz.zhouzhaodong.crm.dto.JurisdictionDto;
import xyz.zhouzhaodong.crm.service.IJurisdictionService;
import xyz.zhouzhaodong.crm.util.NoRepeatSubmit;
import xyz.zhouzhaodong.crm.util.RestMessage;

import javax.annotation.Resource;

/**
 * <p>
 *  权限管理
 * </p>
 *
 * @author zhouzhaodong
 * @since 2020-06-14
 */
@RestController
@RequestMapping("/jurisdiction")
public class JurisdictionController {

    @Resource
    IJurisdictionService jurisdictionService;

    /**
     * 新增权限管理
     * @return
     */
    @NoRepeatSubmit
    @RequestMapping("/add")
    public RestMessage addJurisdiction(JurisdictionDto jurisdictionDto){
        return jurisdictionService.addJurisdiction(jurisdictionDto);
    }

    /**
     * 逻辑删除权限
     * @param id
     * @param staffId
     * @return
     */
    @RequestMapping("/delete")
    public RestMessage deleteJurisdiction(String id, String staffId){
        return jurisdictionService.deleteJurisdiction(id, staffId);
    }

    /**
     * 更新权限
     * @param jurisdictionDto
     * @return
     */
    @RequestMapping("/update")
    public RestMessage updateJurisdiction(JurisdictionDto jurisdictionDto){
        return jurisdictionService.updateJurisdiction(jurisdictionDto);
    }

    /**
     * 根据岗位id查询权限
     * @param stationId
     * @return
     */
    @RequestMapping("/select")
    public RestMessage selectOne(String stationId){
        return jurisdictionService.selectOne(stationId);
    }

}
